package com.jugheadzhou.influxdb2test.service;

import com.jugheadzhou.influxdb2test.manager.IcuCollectBucketApiManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author jugheadzhou
 */
@Slf4j
@Service
public class TestService {
    @Resource
    private IcuCollectBucketApiManager icuCollectBucketApiManager;

    public void icuTemperature(String patientId, @RequestParam("value") String value) {
        Map<String, String> tagsToAdd = new HashMap<>(2);
        tagsToAdd.put("patientId", patientId);
        Map<String, Object> fieldsToAdd = new HashMap<>(2);
        fieldsToAdd.put("value", Double.valueOf(value));
        icuCollectBucketApiManager.writePoint(tagsToAdd, fieldsToAdd);
    }


}
